Using 'this': where is good and where is not [closed]

Posted by abatishchev on Stack Overflow See other posts from Stack Overflow or by abatishchev
Published on 2009-03-16T11:12:06Z Indexed on 2010/04/04 8:43 UTC
Read the original article Hit count: 204

Filed under:
|
|
|

I like to use 'this' statement for all non-local variables: for properties, for class variables, etc. I do this for code easy reading, easy understanding where from this variable has got.

object someVar;

object SomeProperty { get; set }

void SomeMethod(object arg1, object arg2)
{
  this.SomeProperty = arg1;
  this.someVar = arg2;
}

How do you think, what is proper way to use 'this'?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#